package com.example.demo.service;

import com.example.demo.common.SessionUtil;
import com.example.demo.mapper.ArticleMapper;
import com.example.demo.model.ArticleInfo;
import com.example.demo.model.UserInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    public List<ArticleInfo> getMyList(Integer uid){
        return articleMapper.getMyList(uid);
    }

    public ArticleInfo getDetail(Integer aid){
        return articleMapper.getDetail(aid);
    }

    public  int update(Integer aid,String title,String content,Integer uid){
        return  articleMapper.update(aid,title,content,uid);
    }
    public  int del(Integer id){
        return articleMapper.del(id);
    }
    public  List<ArticleInfo> getList2(Integer psize,Integer offset){
        return  articleMapper.getList2(psize,offset);
    }

    public int gettotalpage(){
        return  articleMapper.gettotalpage();
    }

    public int gett(Integer uid){
        return  articleMapper.gett(uid);
    }

    public int writeblog(Integer uid, String title, String content){
            return articleMapper.writeblog(uid,title,content); //sql语句大部分默认返回受影响的行数
    }
}
